﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace shfa.snomtastic.systray.components
{
    public class PresenceStateInfo
    {
        public enum PresenceStateType { Available, AvailableIdle, Busy, BusyIdle, DoNotDisturb, BeRightBack, Away, Offline, unknown };

        public PresenceStateType State { get; set; }
        public PresenceStateInfo() 
        {
            this.State = PresenceStateType.unknown;
        }

        public void SetState(int i)
        {

            this.State = getStateFromInteger(i);
        }

        public void SetState(PresenceStateType pst)
        {
            this.State = pst;
        }

        public PresenceStateType getStateFromInteger(int i)
        {

            if (i >= 2999 & i <= 4499)
                return PresenceStateType.Available;
            if (i >= 4500 & i <= 5999)
                return PresenceStateType.AvailableIdle;
            if (i >= 6000 & i <= 7499)
                return PresenceStateType.Busy;
            if (i >= 7500 & i <= 8999)
                return PresenceStateType.BusyIdle;
            if (i >= 9000 & i <= 11999)
                return PresenceStateType.DoNotDisturb;
            if (i >= 12000 & i <= 14999)
                return PresenceStateType.BeRightBack;
            if (i >= 15000 & i <= 17999)
                return PresenceStateType.Away;
            if (i >= 18000)
                return PresenceStateType.Offline;

            return PresenceStateType.unknown;

        }


    }
}
